#define _CRT_SECURE_NO_WARNINGS 1
#include <unordered_map>
#include <iostream>
using namespace std;

int main()
{
    int  n, m, hmax = 0, i, ret = -1;
    cin >> n >> m;
    unordered_map<int, int> hash;
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        hash[tmp]++;
    }
    for (auto [x, y] : hash) hmax = max(hmax, y);

    int left = 1, right = hmax;
    while (left < right)
    {
        int mid = (left + right) / 2;
        int sumnum = 0;
        int num = hash.size();
        for (auto [x, y] : hash)
        {
            sumnum += y / mid + ((y % mid == 0) ? 0 : 1);
        }
        if (sumnum > m) left = mid + 1;
        else right = mid;
    }

    if (left >= hmax) ret = -1;
    else ret = left;
    cout << ret;
    return 0;
}